/* GUI CONVERTED from rcshvid.p (converter v1.75) Sat Aug 12 23:02:22 2000 */
/* rcshvid.p - VALIDATE FA WORK ORDER ID IN INVENTORY DB                     */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                       */
/* All rights reserved worldwide.  This is an unpublished work.              */
/*V8:ConvertMode=Maintenance                                                 */
/*K1Q4*/ /*V8:WebEnabled=No                                                  */
/* REVISION: 8.6           CREATED : 10/29/97   BY: *K15N* Jim Williams      */
/* REVISION: 8.6     LAST MODIFIED : 05/20/98   BY: *K1Q4* Alfred Tan        */
/* REVISION: 8.6     LAST MODIFIED : 10/27/98   BY: *K1XY* Reetu Kapoor      */
/* REVISION: 9.1     LAST MODIFIED : 08/12/00   BY: *N0KP* myb               */
/* MOVED CODE FROM rcshwbc2.p IN ORDER TO VALIDATE WORK ORDER ID IN REMOTE DB*/


/*****************************************************************************/
/* IN ORDER TO USE THIS VALIDATION IN rcshwbc2.p AND rcshwbb.p WE NEEDED TO  */
/* PASS A VALUE OF "NA" IN sodfanbr WHEN sod_det IS 'NOT AVAILABLE'.         */
/* IN rcshwbc2.p THE VALIDATION LOGIC WAS NOT PROCESSED IF sod_det WAS NOT   */
/* AVAILABLE.  IN rcshwbb.p THE VALIDATION LOGIC WAS PROCESSED WHEN sod_det  */
/* WAS NOT AVAILABLE BUT THE CHECK FOR 'WORK ORDER IS FOR A DIFFERENT SO' WAS*/
/* NOT PROCESSED WHEN sod_det WAS NOT AVAILABLE. THEREFORE WHEN sod_det IS   */
/* NOT AVAILABLE IN rcshwbb.p WE WILL PASS "NA" IN sodfanbr.                 */
/*****************************************************************************/

         {mfdeclre.i}

     define input parameter part_fa_lot like wo_lot.
     define input parameter sodfanbr like sod_fa_nbr.
     define output parameter err-flg as logical.

/*K1XY*/ for first fac_ctrl fields (fac_so_rec) no-lock: end.
         find wo_mstr no-lock where
              wo_lot = part_fa_lot no-error.


         if not available wo_mstr then do:
            {mfmsg.i 510 3} /* WO number doesn't exist */
            err-flg = yes.
            return.
         end.
/*K1XY** else if index ("EAR",wo_status) = 0 then do: */
/*K1XY*/ else if index ("EAR",wo_status) = 0  and fac_so_rec = YES then do:
            {mfmsg.i 523 3} /* WO IS CLOSED PLANNED OR FIRM */
            err-flg = yes.
            return.
         end.
         if sodfanbr <> "NA" and wo_nbr <> sodfanbr then
             {mfmsg.i 5852 2} /* WO IS FOR DIFF SO  */
